home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / boot / netBoot / sun4.md / RCS / map.s,v < prev    next >
Encoding:
Text File  |  1989-06-19  |  2.0 KB  |  101 lines

  1. head     1.1;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    mendel:1.1; strict;
  6. comment  @| @;
  7.  
  8.  
  9. 1.1
  10. date     89.06.19.14.16.19;  author mendel;  state Exp;
  11. branches ;
  12. next     ;
  13.  
  14.  
  15. desc
  16. @@
  17.  
  18.  
  19.  
  20. 1.1
  21. log
  22. @Initial revision
  23. @
  24. text
  25. @!
  26. !    .seg    "data"
  27. !    .asciz    "@@(#)map.s 1.5 88/02/08"
  28. !    Copyright (c) 1986 by Sun Microsystems, Inc.
  29. !
  30.  
  31. !
  32. ! Memory Mapping for Sun 4
  33. !
  34. ! The following subroutines accept any address in the mappable range
  35. ! (256 megs).  They access the map for the current context register.  They
  36. ! assume that currently we are running in supervisor state.
  37. ASI_SM=3            ! address spaces indentifier for segment map
  38. ASI_PM=4            ! address spaces indentifier for page map
  39. SEGMENTADDRBITS=0xFFFC0000    ! relevant bits of a segment in vitrual address
  40.  
  41.     .seg    "text"
  42.  
  43. !
  44. ! Read the page map entry for the given address v
  45. ! and return it in a form suitable for software use.
  46. !
  47. ! long
  48. ! getpgmap(v)
  49. ! caddr_t v;
  50. !
  51.     .global _getpgmap
  52. _getpgmap:
  53.     andn    %o0,0x3,%o1        ! align to word boundary
  54.     lda    [%o1]ASI_PM,%o0        ! read page map entry
  55.     retl
  56.     nop                ! nop hack needed for proto 1 XXXX
  57.  
  58. ! Set the pme for address v using the software pte given.
  59. ! setpgmap(v, pte)
  60. ! caddr_t v;
  61. ! long pte;
  62.     .global _setpgmap
  63. _setpgmap:
  64.     andn    %o0,0x3,%o2        ! align to word boundary
  65.     retl
  66.     sta    %o1,[%o2]ASI_PM        ! write page map entry
  67.  
  68. !
  69. ! Set the segment map entry for segno to pm.
  70. ! setsegmap(v, pm)
  71. ! u_int segno;
  72. ! u_short pm;
  73.     .global _setsegmap
  74. _setsegmap:
  75.     set    SEGMENTADDRBITS, %o2
  76.     and    %o0, %o2, %o0        ! get relevant segment address bits
  77.     retl
  78.     stha    %o1,[%o0]ASI_SM        ! write segment entry
  79. /*
  80.  * Get the segment map entry for ther given virtual address
  81.  *
  82.  * getsegmap(v)
  83.  * caddr_t vaddr;
  84.  */
  85.     .global _getsegmap
  86. _getsegmap:
  87.         set     SEGMENTADDRBITS, %o2
  88.         and     %o0, %o2, %o0           ! get relevant segment address bits
  89.         lduha   [%o0]ASI_SM,%o0         ! read segment entry
  90.     set     _segmask, %o2           ! need to mask bits due to bug in cobra
  91.     ld      [%o2], %o2
  92.     retl
  93.     and     %o0, %o2, %o0
  94. @
  95.